⚡ [Performance Improvement] Parallelize check-updates script HTTP requests#2
Conversation
Co-authored-by: Serendeep <36764254+Serendeep@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR parallelizes formula update checks in scripts/check-updates.py by running check_formula() concurrently, reducing overall runtime by overlapping network I/O (GitHub API calls and downloads).
Changes:
- Introduce
concurrent.futures.ThreadPoolExecutorusage in the updates-checking loop. - Run
check_formula()across multiple formula files in parallel and apply updates as results are collected.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| with concurrent.futures.ThreadPoolExecutor() as executor: | ||
| results = executor.map(check_formula, formulas_to_check) | ||
|
|
There was a problem hiding this comment.
ThreadPoolExecutor() is created without an explicit max_workers, so the concurrency level will vary by machine (defaults to min(32, os.cpu_count()+4)). As the number of formulas grows this can create a large burst of concurrent GitHub API requests + tarball downloads/hashing, increasing the chance of rate-limiting or flaky timeouts in the scheduled workflow. Consider setting a reasonable upper bound (and optionally making it configurable via CLI flag/env var) based on I/O-bound workload expectations.
💡 What: Modified
scripts/check-updates.pyto useconcurrent.futures.ThreadPoolExecutor().mapto runcheck_formulain parallel for multiple formulas.🎯 Why: The sequential nature of checking formulas was causing unnecessary delays, as each HTTP request to check GitHub releases or other URLs waited for the previous one to finish. Parallelizing network I/O reduces the overall time to run
check-updates.pyacross the tap significantly.📊 Measured Improvement: Running the script on the existing test formulas dropped the execution time from ~1.06 seconds to ~0.56 seconds. This represents an ~47% speed improvement. The improvement will scale effectively as more formulas are added to the tap.
PR created automatically by Jules for task 3841537405918422282 started by @Serendeep